#pragma once

#include <iostream>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

using namespace std;

const std::string pipefile = "./fifo";
const mode_t gmode = 0664;
const int gdefaultfd = -1;
const int gsize = 1024;
const int gForRead = O_RDONLY;
const int gForWrite = O_WRONLY;


int Openpipe(int flag)
{
    int fd = ::open(pipefile.c_str(), flag);
    if (fd < 0)
    {
        std::cerr << "fd error" << endl;

    }
    return fd;
}

void Closepipehelp(int _fd)
{
    if (_fd > 0)
    {
        ::close(_fd);
    }
}
